import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Main from "../views/Main";
import loading from "../views/loading";
import UserFileList from "../views/UserFileList";
import UserMessage from "../views/UserMessage";
import ShareFiles from "../views/ShareFiles";
import AddFile from "../views/AddFile";
import ForgetPassword from "../views/ForgetPassword";
import SharePace from "../views/SharePace";
import DirManage from "../views/DirManage";
import Userloginloading from "../views/Userloginloading"
import DirMain from "../views/DirMain";
import demo from "../views/demo";
import ChangePassword from "../views/ChangePassword";
import Videos from "../views/Videos"
import Images from "../views/Images";
import Others from "../views/Others";
import Texts from "../views/Texts";
Vue.use(VueRouter)
//解决路由雍余问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


const routes = [
    {
      path:'/demo',
        name:'demo',
        component: demo
    },

  {
    path: '/forgetpass',
    name:'forgetpass',
    component: ForgetPassword
  },{

  path: "/loginloading",
    name:'loginloading',
    component: Userloginloading
  },

{
  path: '/loading',
    name:'loading',
    component: loading
  },
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/Main',
    name: 'Main',
    component: Main,
    children:[
{
        path: '/UserMessage',
        name:'UserMessage',
        component: UserMessage
      },{
      path: '/ShareFiles',
        name:'ShareFiles',
        component: ShareFiles
      },{
      path: '/AddFile',
        name:'AddFile',
        component: AddFile
      },{
        path: '/SharePace',
        name:'SharePace',
        component: SharePace
      },{
      path: '/DirManage',
        name:'DirManage',
        component: DirManage
      },
      {
        path: '/ChangePassword',
        name:'ChangePassword',
        component: ChangePassword
      },
      {
        path:'/DirMain',
        name: 'DirMain',
        component: DirMain,
        children:[
          {
            path: '/UserFileList',
            name: 'UserFileList',
            component: UserFileList
          },
            {
                path: '/Images',
                name: 'Images',
                component: Images
            },
            {
                path: '/Videos',
                name: 'Videos',
                component: Videos
            }
            ,{
                path: '/Others',
                name: 'Others',
                component: Others
            }
            ,{
                path: '/Texts',
                name: 'Texts',
                component: Texts
            }
        ]
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})


export default router
